package com.shuoyue.ycgk.ui.questionbank.practice.freedom;

import android.os.Bundle;
import android.widget.TextView;

import com.shuoyue.ycgk.R;
import com.shuoyue.ycgk.base.BaseMvpFragment;
import com.shuoyue.ycgk.entity.QuestionParent;

import butterknife.BindView;
import butterknife.OnClick;

public class FragmentSpace extends BaseMvpFragment {
    @BindView(R.id.nowPos)
    TextView nowPos;
    @BindView(R.id.total)
    TextView total;
    @BindView(R.id.name)
    TextView name;
    QuestionParent questionParent;

    public static FragmentSpace getInstance(QuestionParent parent) {
        FragmentSpace fragmentSpace = new FragmentSpace();
        Bundle bundle = new Bundle();
        bundle.putSerializable("data", parent);
        fragmentSpace.setArguments(bundle);
        return fragmentSpace;
    }

    @Override
    public void initParams(Bundle bundle) {
        questionParent = (QuestionParent) bundle.getSerializable("data");

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_question_space;
    }

    @Override
    protected void initView() {
        nowPos.setText(String.valueOf(questionParent.getNowGroupPos()));
        total.setText(String.valueOf(questionParent.getTotalGroup()));
        name.setText(questionParent.getSpaceName());
    }

    @OnClick(R.id.start)
    public void onViewClicked() {
        ((FreedomQuestionActivity) getActivity()).goNext();
    }
}
